const initState = {
  // 用户信息
  userInfo: {},
  // 用户收藏
  collectionList: []
}

export const userReducer = (prevState = initState, action) => {
  switch (action.type) {
    case 'updateUserInfo': {
      return {
        ...prevState,
        userInfo: action.payload
      }
    }
    case 'addCollectionList': {
      return {
        ...prevState,
        collectionList: [...prevState.collectionList, action.payload]
      }
    }
    default: return prevState
  }
}